package com.profound.notes.component;

import ohos.agp.components.Component;
import ohos.agp.utils.Rect;

/**
 * @author zjwujlei
 * @date 2021/4/29
 * @email zjwujlei@sina.com
 * @description
 */

public class RecyclerItem {

    public static RecyclerItem Default = new RecyclerItem();

    public RecyclerItem() {
    }

    SpanLayoutManager.Span span;

    int index = 0;
    int marginLeft = 0;
    int marginTop = 0;
    int marginRight = 0;
    int marginBottom = 0;
    int positionX = 0;
    int positionY = 0;
    int width = 0;
    int height = 0;

    int nextPositionX = 0;
    int nextPositionY = 0;

    Rect rect;

    Component child;

    public int getLeft(){
        return positionX;
    }

    public int getTop(){
        return positionY;
    }

    public int getRight(){
        return positionX+marginLeft+marginRight+width;
    }

    public int getBottom(){
        return positionY+marginTop+marginBottom+height;
    }

    public int getHSpace(){
        return marginLeft+marginRight+width;
    }

    public int getVSpace(){
        return marginTop+marginBottom+height;
    }

    public Component recycleComponent(){
        Component temp = child;
        child = null;
        return temp;
    }




    @Override
    public String toString() {
        return "Layout{" +
                "index=" + index +
                ", positionX=" + positionX +
                ", positionY=" + positionY +
                ", width=" + width +
                ", height=" + height +
                '}';
    }
}
